package modelo.bean;

import java.io.Serializable;

import javax.persistence.*;

import org.hibernate.annotations.Index;

/*A LatLng is a point in geographical coordinates: latitude and longitude.
 Latitude ranges between -90 and 90 degrees, inclusive. Values above or below this range 
 will be clamped to the nearest value within this range. For example, specifying a latitude of 
 100 will set the value to 90.
 Longitude ranges between -180 and 180 degrees, inclusive. Values above or below this range will 
 be wrapped such that they fall within the range [-180, 180). For example, 480, 840 and 1200
 will all be wrapped to 120 degrees.*/

@Entity
@Table(name = "latlng")
@Inheritance(strategy = InheritanceType.JOINED)
public class LatLng implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Index(name = "id_latLng_pk")
	@Column(name = "id_latlng")
	private Long id_latlng;

	@Column(name = "lat")
	private double lat;

	@Column(name = "lng")
	private double lng;

	@ManyToOne(fetch = FetchType.LAZY, optional = false)
	@JoinColumn(name = "id_trajeto", referencedColumnName = "id_trajeto")
	Trajeto id_trajeto;

	public LatLng() {
	}

	// public LatLng(double parseDouble, double parseDouble2) {
	// // TODO Auto-generated constructor stub
	// }

	/**
	 * @return the id_latLng
	 */
	public Long getId_latLng() {
		return id_latlng;
	}

	/**
	 * @param id_latLng
	 *            the id_latLng to set
	 */
	public void setId_latLng(Long id_latLng) {
		this.id_latlng = id_latLng;
	}

	/**
	 * @return the lat
	 */
	public double getLat() {
		return lat;
	}

	/**
	 * @param lat
	 *            the lat to set
	 */
	public void setLat(double lat) {
		this.lat = lat;
	}

	/**
	 * @return the lng
	 */
	public double getLng() {
		return lng;
	}

	/**
	 * @param lng
	 *            the lng to set
	 */
	public void setLng(double lng) {
		this.lng = lng;
	}

	/**
	 * @return the id_trajeto
	 */
	public Trajeto getId_trajeto() {
		return id_trajeto;
	}

	/**
	 * @param id_trajeto
	 *            the id_trajeto to set
	 */
	public void setId_trajeto(Trajeto id_trajeto) {
		this.id_trajeto = id_trajeto;
	}
	
	public LatLng(double lat, double lng){
		setLat(lat);
		setLng(lng);
	}
	

}
